#include <iostream>
#define MaxSize 50
using namespace std;

int put(int *n)
{
    int m;
    cin >> m;
    *n = m;
    return *n;
}

typedef struct linknode
{
    int data;
    struct linknode *next;
} zhan;

void InitStack(zhan *&s)
{
    s = (zhan *)malloc(sizeof(zhan));
    s->next = NULL;
}

void push(zhan *&s, int *n)
{
    zhan *p;
    p = (zhan *)malloc(sizeof(zhan));
    p->data = *n;
    p->next = s->next;
    s->next = p;
}

int GetTop(zhan *&s, int *n)
{
    /*if (s->next == NULL)
		cout<<"此栈为空"<<endl;*/
    *n = s->next->data;
    int i = 0, a[MaxSize], length = 0;
    do
    {
        a[i] = *n % 2;
        *n = *n / 2;
        i++;
        length++;
    } while (*n != 1);
    a[length] = *n;
    for (i = length; i >= 0; i--)
    {
        cout << a[i];
    }
    cout << endl;
    return a[i];
}

int main()
{
    int n = 0;
    zhan *s;
    InitStack(s);
    push(s, &n);
    put(&n);
    GetTop(s, &n);
}